package com.openitems.data.pojo;

// Generated Aug 11, 2014 11:52:00 PM by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Item generated by hbm2java
 */
@Entity
@Table(name = "item", catalog = "openitems")
public class Item implements java.io.Serializable {

	private Integer id;
	private Resource resource;
	private Item item;
	private Artifact artifact;
	private String number;
	private String name;
	private String descripion;
	private String status;
	private Date startDate;
	private Date completedDate;
	private String type;
	private Set<Item> itemsForOneId = new HashSet<Item>(0);
	private Set<Item> items = new HashSet<Item>(0);
	private Set<Item> itemsForTwoId = new HashSet<Item>(0);

	public Item() {
	}

	public Item(Artifact artifact, String number, String name) {
		this.artifact = artifact;
		this.number = number;
		this.name = name;
	}

	public Item(Resource resource, Item item, Artifact artifact, String number,
			String name, String descripion, String status, Date startDate,
			Date completedDate, String type, Set<Item> itemsForOneId,
			Set<Item> items, Set<Item> itemsForTwoId) {
		this.resource = resource;
		this.item = item;
		this.artifact = artifact;
		this.number = number;
		this.name = name;
		this.descripion = descripion;
		this.status = status;
		this.startDate = startDate;
		this.completedDate = completedDate;
		this.type = type;
		this.itemsForOneId = itemsForOneId;
		this.items = items;
		this.itemsForTwoId = itemsForTwoId;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "assigned_to")
	public Resource getResource() {
		return this.resource;
	}

	public void setResource(Resource resource) {
		this.resource = resource;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent")
	public Item getItem() {
		return this.item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "artifact_id", nullable = false)
	public Artifact getArtifact() {
		return this.artifact;
	}

	public void setArtifact(Artifact artifact) {
		this.artifact = artifact;
	}

	@Column(name = "number", nullable = false, length = 45)
	public String getNumber() {
		return this.number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	@Column(name = "name", nullable = false, length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "descripion", length = 50)
	public String getDescripion() {
		return this.descripion;
	}

	public void setDescripion(String descripion) {
		this.descripion = descripion;
	}

	@Column(name = "status", length = 45)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "start_date", length = 10)
	public Date getStartDate() {
		return this.startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "completed_date", length = 10)
	public Date getCompletedDate() {
		return this.completedDate;
	}

	public void setCompletedDate(Date completedDate) {
		this.completedDate = completedDate;
	}

	@Column(name = "type", length = 45)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "item_linkage", catalog = "openitems", joinColumns = { @JoinColumn(name = "two_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "one_id", nullable = false, updatable = false) })
	public Set<Item> getItemsForOneId() {
		return this.itemsForOneId;
	}

	public void setItemsForOneId(Set<Item> itemsForOneId) {
		this.itemsForOneId = itemsForOneId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "item")
	public Set<Item> getItems() {
		return this.items;
	}

	public void setItems(Set<Item> items) {
		this.items = items;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "item_linkage", catalog = "openitems", joinColumns = { @JoinColumn(name = "one_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "two_id", nullable = false, updatable = false) })
	public Set<Item> getItemsForTwoId() {
		return this.itemsForTwoId;
	}

	public void setItemsForTwoId(Set<Item> itemsForTwoId) {
		this.itemsForTwoId = itemsForTwoId;
	}

}
